package nodelab;

import java.io.Serializable;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;

public class Node implements Serializable, Observer {
	private Map<Node, Integer> inputStatistics;//statistics
	private Map<Node, Integer> outputStatistics;
	
	private Node[] nodeSequence;//pattern
	
	private Set<Node> toObserve;//abstract
	
	private NodeSystem system;
	
	private List<Node> belongs;
	
	public Node() {
//		preNodes = new HashSet<Node>();
//		nxtNodes = new HashSet<Node>();
		belongs = new LinkedList<Node>();
	}
	
	public void setNodeSystem(NodeSystem system) {
		this.system = system;
	}
	
	public List<Node> getBelongs() {
		return belongs;
	}
	
	
	@Override
	public void update(Observable o, Object arg) {
		if(o instanceof NodeInstance) {
			if(toObserve.contains(o)) {
				system.addCurrentHiddenNode(this);
			}
		}
	}
}
